###23decempber######kurgan-sity-russia#####soloweow d########
########
scl = 8
########
#postcript format letter
print "%!PS-Adobe-3.0 EPSF-3.0"
pos_y = scl * 70
(C,D,E,F,G,A,B,c,d,e,f,g,a,b) = range(pos_y-scl,pos_y+scl*6,scl/2)
pos_x = []
pos_x = range(30,730,scl*2)
#open file in for read
ff = open("inp","r")
### def drawing
size = 0
txt = "ok"
diam = scl/2
fill = False
pal = True
single = False
bar = False
onex = 0
oney = 0
twox = 0
twoy = 0
obe = False
def text():
	print "/Times-Roman findfont"
	print str(size) +" scalefont"
	print "setfont"
	print "newpath"
	print str(posx)+ " " + str(posy) + " " + " moveto"
	print "( "+txt+ " ) show"
def circle():
	print "newpath"
        print str(posx) + " " + str(posy) + " " + str(diam)+" 0 360 arc closepath"
	if fill == True:	
		print "0 0 0 setgray fill"
	print "0.5 setlinewidth"
        print "stroke"	
def line():
	global posx,posy,posx1,posy1,obe
	if obe == True:
		posx = onex
		posx1 = twox
		posy = oney
		posy1 = twoy
	print "newpath"
	print str(posx)+" "+ str(posy) + " moveto"
	print str(posx1)+" "+ str(posy1) + " lineto"
	if single == True:
		print str(x2)+" "+ str(y2) + " moveto"
		print str(x3)+" "+ str(y3) + " lineto"
		print "curveto" 	
	print "0.5 setlinewidth"
	print "stroke"
	obe = False
i = 0
while True:
	ch = ff.read(1)
	if ch == "2":
		fill = True
		pal = True
		continue	
	elif ch == "C":
		posy = C
		posy1 = C
		posx = pos_x[i]-scl
		posx1 = pos_x[i]+scl
		line()
	elif ch == "D":
		posy = D
		posy1 = D
	elif ch == "E":
		posy = E
		posy1 = E
	elif ch == "F":
		posy = F
		posy1 = F
	elif ch == "(":
		onex = posx
		oney = posy1
		continue
	elif ch == ")":
		twox = posx
		twoy = posy1
		obe = True
		line()
		continue
	elif ch == " ":
		i = i + 1
		continue
	elif ch == "|":
		if bar == True:
			posy = f
			posy1 = posy-scl*4
			posx = pos_x[i]-scl/2
			posx1 = pos_x[i]-scl/2
			line()
			bar = False
		else:
			posy = f
			posy1 = posy-scl*4
			posx = pos_x[i]-scl
			posx1 = pos_x[i]-scl
			line()
			bar = True
			i = i + 1
		continue
	elif ch == '"':
		tx = pos_x[i-3]-scl*2.5
		pr = 0
		while True:
			ch = ff.read(1)
			if ch == '"':
				break
			else:
				size = 20
				posx = tx + pr
				posy = pos_y+scl*7
				txt = ch 
				text()
				pr = pr + scl*2
				continue
		i = i - 1
		continue
	elif not ch:
		break
	else:
		continue
	posx = pos_x[i]
	posx1 = pos_x[i]+scl/2
	circle()
	if pal == True:
		posx = pos_x[i]+scl/2
		posy1 = posy + scl*4
		line()
	i = i + 2
i = 0
stan = []
stan = range(pos_y,pos_y+scl*5,scl)
posx = 10
posx1 = 730
posy = pos_y
posy1 = posy
for lin in stan:
	line()
	posy = posy + scl
	posy1 = posy1 + scl
	print lin
ff.close()
